import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import LoginView from "@/views/LoginView";

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    children: [
      {
        path: '/sys-index',
        name: '首页',
        component: () => import('../views/SystemAdminIndex')
      },
      {
        path: '/sys-admin/serve/user',
        name: '用戶管理',
        component: () => import('../views/sys-admin/server/UserListView')
      },
      {
        path: '/sys-admin/serve/show',
        name: '车展管理',
        component: () => import('../views/sys-admin/server/ShowListView')
      },
      {
        path: '/sys-admin/serve/show/add-new',
        name: '新增车展',
        component: () => import('../views/sys-admin/server/ShowAddNewView')
      },
      // ======================== 购票管理 ========================
      {
        path: '/sys-admin/serve/ticket-order',
        name: '购票订单管理',
        component: () => import('../views/sys-admin/server/TicketOrderListView')
      },
      {
        path: '/sys-admin/serve/ticket-order/add-new',
        name: '新增购票订单',
        component: () => import('../views/sys-admin/server/TicketOrderAddNewView')
      },
      {
        path: '/sys-admin/serve/ticket-list',
        name: '购票列表管理',
        component: () => import('../views/sys-admin/server/TicketListListView')
      },
      // ======================== 轮播图管理 ========================
      {
        path: '/sys-admin/serve/banner',
        name: '轮播图维护',
        component: () => import('../views/sys-admin/server/BannerListView.vue')
      },
      {
        path: '/sys-admin/serve/banner/add-new',
        name: '新增轮播图',
        component: () => import('../views/sys-admin/server/BannerAddNewView.vue')
      },
      // ======================== 权限管理 ========================
      // ======================== 管理员管理 ========================
      {
        path: '/sys-admin/permission/admin',
        name: '管理员管理',
        component: () => import('../views/sys-admin/permission/AdminListView')
      },
      {
        path: '/sys-admin/permission/admin/add-new',
        name: '新增管理员',
        component: () => import('../views/sys-admin/permission/AdminAddNewView')
      },
      // ======================== 角色管理 ========================
      {
        path: '/sys-admin/permission/role',
        name: '角色管理',
        component: () => import('../views/sys-admin/permission/RoleListView')
      },
      {
        path: '/sys-admin/permission/role/add-new',
        name: '新增角色',
        component: () => import('../views/sys-admin/permission/RoleAddNewView')
      },
      // ======================== 权限管理 ========================
      {
        path: '/sys-admin/permission/permission',
        name: '权限管理',
        component: () => import('../views/sys-admin/permission/PermissionListView')
      },
      {
        path: '/sys-admin/permission/permission/add-new',
        name: '新增权限',
        component: () => import('../views/sys-admin/permission/PermissionAddNewView')
      }
    ]
  },
  {
    path: '/login',
    component: () => import('../views/LoginView.vue')
  },
  {
    path: '/index',
    component: () => import('../views/web/IndexView')
  },
  {
    path: '/webLogin',
    component: () => import('../views/web/LoginView')
  },
  {
    path: '/showList',
    component: () => import('../views/web/ShowListView')
  },
  {
    path: '/show',
    component: () => import('../views/web/ShowItemView')
  },
  {
    path: '/about1',
    component: () => import('../views/web/AboutView1')
  },
  {
    path: '/userManagement',
    component: () => import('../views/web/UserManagement'),
    children: [
      {
        path: '/userManagement/avatar',
        component: () => import('../views/web/UserAvatar')
      },
      {
        path: '/userManagement/info',
        component: () => import('../views/web/UserInfo')
      },
      {
        path: '/userManagement/pwd',
        component: () => import('../views/web/UserPwd')
      },
      {
        path: '/userManagement/order',
        component: () => import('../views/web/UserOrder')
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
